<template>
  <el-row class="w-100 p-3">
    <el-col>
      <el-form>
        <table border="1" class="w-100" style="border:1px solid #0D2264">
          <tr height="50">
            <td width="120" align="right">* 传感器类型：</td>
            <td class="px-2">
              <el-select class="w-100" v-model="sensor.BaseSpec" size="small">
                <el-option label="485传感器" :value="1"></el-option>
                <el-option label="照度传感器" :value="2"></el-option>
              </el-select>
            </td>
          </tr>
          <tr height="50">
            <td width="120" align="right">* 型号：</td>
            <td class="px-2">
              <el-tooltip class="item" :content="errors.first('LightSourceType')" :value="errors.has('LightSourceType')" :manual="true">
                <el-input placeholder="请输入内容" size="small" v-model="sensor.LightSourceType" class="w-100"
                :class="{'is-error':errors.has('LightSourceType')}" v-validate="'required'" name="LightSourceType"></el-input>
              </el-tooltip>
            </td>
          </tr>
          <tr height="50">
            <td width="120" align="right" >* 通讯地址：</td>
            <td class="px-2">
              <el-tooltip class="item" :content="errors.first('InstallPosition')" :value="errors.has('InstallPosition')" :manual="true">
                <el-input placeholder="请输入内容" size="small" v-model="sensor.InstallPosition" class="w-100"
                :class="{'is-error':errors.has('InstallPosition')}" v-validate="'required'" name="InstallPosition"></el-input>
              </el-tooltip>
            </td>
          </tr>
          <tr height="50">
            <td width="30%" align="right" style="padding-right:5px">* 波特率：</td>
            <td style="padding:10px 10px">
              <el-tooltip class="item" :content="errors.first('MaintenanceUser')" :value="errors.has('MaintenanceUser')" :manual="true">
                <el-input placeholder="请输入内容" size="small" v-model="sensor.LightType" class="w-100"
                 :class="{'is-error':errors.has('MaintenanceUser')}" v-validate="'required'" name="MaintenanceUser"></el-input>
              </el-tooltip>
            </td>
          </tr>
          <tr height="50">
            <td width="30%" align="right" style="padding-right:5px">* 通讯模式：</td>
            <td style="padding:10px 10px">
              <el-tooltip class="item" :content="errors.first('PoleType')" :value="errors.has('PoleType')" :manual="true">
                <el-input placeholder="请输入内容" size="small" v-model="sensor.PoleType" class="w-100"
                :class="{'is-error':errors.has('PoleType')}" v-validate="'required'" name="PoleType"></el-input>
              </el-tooltip>
            </td>
          </tr>
          <tr height="50">
            <td width="30%" align="right" style="padding-right:5px">* 照度值：</td>
            <td style="padding:10px 10px">
              <el-tooltip class="item" :content="errors.first('Lamps')" :value="errors.has('Lamps')" :manual="true">
                <el-input placeholder="请输入内容" size="small" v-model="sensor.Lamps" class="w-100"
                          :class="{'is-error':errors.has('Lamps')}" v-validate="'required'" name="Lamps"></el-input>
              </el-tooltip>
            </td>
          </tr>
        </table>
        <div class="w-100 mt-3 text-center" >
          <el-button class="ur-btn ur-btn-primary w80" @click="save"><i class="iconfont icon-sure"></i>确定</el-button>
          <el-button class="ur-btn ur-btn-primary w80" @click.native="closeDialog"><i class="iconfont icon-close3"></i>取消</el-button>
        </div>
      </el-form>
    </el-col>
  </el-row>
</template>

<script>
  import { mapState } from 'vuex'
  import api from 'api/api'
  import fetch from 'api/fetch'
  export default {
    components: {},
    props: {
      sensor: {BaseSpec:1},
    },
    data() {
      return {
      }
    },
    watch: {},
    computed: {},
    methods: {
      save() {
        this.$validator.validateAll().then((res) => {
          if (res) {
            this.closeAreaDialog()
          }
        })
      },
      closeAreaDialog() {
        this.$emit('closeAreaDialog', false)
      }
    },
    created() {
    },
    mounted() {

    }
  }
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
</style>
